import java.util.ArrayList;
import java.util.Collections;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

public class test2 {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        ArrayList<Integer> list = new ArrayList<>();
        Collections.addAll(list, 10, 5, 20, 50, 100, 200, 500, 800, 2, 80, 300, 700);

        MyCallable cb = new MyCallable(list);

        FutureTask<Integer> ft1 = new FutureTask<>(cb);
        FutureTask<Integer> ft2 = new FutureTask<>(cb);

        Thread t1 = new Thread(ft1);
        Thread t2 = new Thread(ft2);

        t1.setName("抽奖盒1");
        t2.setName("抽奖盒2");

        t1.start();
        t2.start();

        int r1 = ft1.get();
        int r2 = ft2.get();

        if (r1 > r2) {
            System.out.println("抽奖盒1最大" + r1 + "元");
        } else {
            System.out.println("抽奖盒2最大" + r2 + "元");
        }
    }
}
